import { defineStore } from 'pinia'
import { ref } from 'vue'
import { CustomAddressVo } from '@/service/user/address.d'

export const useActiveAddressStore = defineStore(
  'activeAddress',
  () => {
    const addressData = ref<CustomAddressVo>({} as CustomAddressVo)
    const setActiveAddress = (address: CustomAddressVo) => {
      addressData.value = address
    }
    const removeAddress = () => {
      addressData.value = null
    }
    return { addressData, setActiveAddress, removeAddress }
  },
  { persist: true },
)
